const router = require("koa-router")();
const banner = require("../data/banner");
const top250 = require("../data/top250");

router.get("/",async ctx=>{
    ctx.body = "hello world"
})
router.get("/api/banner",async ctx=>{
    ctx.body = banner
})
router.get("/api/top250",async ctx=>{
    ctx.body = top250
})
router.get("/api/subject",async ctx=>{
    var {id} = ctx.request.query;
    var item = top250.find(item=>{
        return item._id == id;
    })
    ctx.body = item;
})

module.exports = router;